"use strict";

/**
 * @auther wtfssd
 * Created by wtfssd on 2017/11/17
 */
import * as React from 'react'
import PropTypes from 'prop-types'
import {commonStyles} from "../assets/styles/common";
import {LoadingViewProps} from "./index";
const { View,ActivityIndicator,Text} = require('react-native');


const LoadingView = (props:LoadingViewProps)=>{
    if (props.loading){
        return (
            <View style={[commonStyles.centerVH,{flex:1,backgroundColor:'#fff'}]}>
                <ActivityIndicator
                    size='large'
                    color="black"
                />
                <Text style={{marginTop:20}}>加载中...</Text>
            </View>
        )
    }else {
        return (
            <View style={[{flex:1},props.style]}>
                {props.children}
            </View>
        )
    }

};



export default LoadingView;